<!-- TASKBOARD VIEW -->
<% content_for :head_tags do %>
  <%= javascript_include_tag  'show_main', 'board_updater', 'taskboard_updater', 'taskboard', 'model', 'issue', 'task', 'impediment', 'story_taskboard', :plugin => 'redmine_backlogs' %>
  <%= stylesheet_link_tag 'jqplot.css', :plugin => 'redmine_backlogs' %>
  <%= theme_stylesheet_link_tag 'taskboard.css', :media => 'print,screen' %>
  <%= theme_stylesheet_link_tag 'taskboard_print.css', :media => 'print' %>
  <script type="text/javascript" src="<%= url_for(:controller => 'rb_server_variables', :action => 'show', :project_id => @project.id, :sprint_id => @sprint.id) %>"></script>
<% end %>

<% content_for :breadcrumbs do %>
  <%= link_to l(:label_master_backlog), :controller => "rb_master_backlogs", :action => "show", :project_id => @project %>
  <%= breadcrumb_separator %>
  <%= @sprint.name %>
<% end %>

<%- content_for :view_specific_links do %>
  <% if @sprint.has_burndown %>
    <a id='show_charts'><%= l(:label_burndown) %></a>
  <% end %>
  <span id="col_width">Column width: <input name="col_width"/></span>
  <a id="disable_autorefresh">Disable Auto-refresh</a>
  <a id="refresh">Refresh</a>
<%- end %>

<%- content_for :main do %>
<div id="taskboard">
  <table id="board_header" cellspacing="0">
    <tr>
      <td><%= l(:backlogs_story) %></td>
      <%- @statuses.each do |status| %>
      <td class="swimlane"><%= status.name %></td>
      <%- end %>
    </tr>
  </table>
  <table id="tasks" class="board nobugs_board" cellspacing="0">
    <%- @sprint.stories.each do |story| %>
    <tr>
      <td>
        <%= render :partial => "rb_stories/story_taskboard", :object => story, :locals => { :story => story } %>
      </td>
      <td class="add_new">+</td>
      <%- @statuses.each do |status| %>
      <td class="swimlane list <%= status.is_closed? ? 'closed' : '' %>" id="<%= story.id %>_<%= status.id %>">
        <%= render :partial => "rb_tasks/task", :collection => story.descendants.select{|task| task.status.id==status.id} %>
      </td>
      <%- end %>
    </tr>
    <%- end %>
  </table>
  <table id="tasks1" class="board nobugs_board" cellspacing="0">
    <tr>
      <td><div class="label_sprint_impediments"><%= l(:label_sprint_tasks) %></div></td>
      <td class="add_new">+</td>
      <%- @statuses.each do |status| %>
      <td class="swimlane list <%= status.is_closed? ? 'closed' : '' %>" id="_<%= status.id %>">
        <%= render :partial => "rb_tasks/task", :collection => @sprint.tasks1.select{|impediment| impediment.status_id==status.id} %>
      </td>
      <%- end %>
    </tr>
  </table>
  <table id="tasks2" class="board" cellspacing="0">
    <tr>
      <td><div class="label_sprint_impediments"><%= l(:label_sprint_bugs) %></div></td>
      <td class="add_new">+</td>
      <%- @statuses.each do |status| %>
      <td class="swimlane list <%= status.is_closed? ? 'closed' : '' %>" id="_<%= status.id %>_bug">
        <%= render :partial => "rb_tasks/task", :collection => @sprint.tasks2.select{|impediment| impediment.status_id==status.id} %>
      </td>
      <%- end %>
    </tr>
  </table>
</div>
<%- end %>

<%- content_for :helpers do %>
  <select class="priority_id template" id="priority_id_options">
    <%- IssuePriority.all.each do |p| %>
    <option value="<%= p.id %>"><%= p.name %></option>
    <%- end %>
  </select>

<select class="status_id helper" id="status_id_options">
  <%- IssueStatus.find(:all, :order => "position ASC").each do |status| %>
  <option value="<%= status.id %>" class="<%= (status.is_closed? ?  l(:label_closed_issues) + ' ' : "") %>"><%= status.name %></option>
  <%- end %>
</select>

  <select class="assigned_to_id template" id="assigned_to_id_options">
    <option value=""> </option>
    <%- @project.members.each do |member| %>
    <option value="<%= member.user_id %>" color="<%= member.user.backlogs_preference(:task_color) %>"><%= member.name %></option>
    <%- end %>
  </select>
  <div id="task_template">
    <%= render :partial => "rb_tasks/task", :object => Task.new %>
  </div>
  <div id="impediment_template">
    <%= render :partial => "rb_impediments/impediment", :object => Task.new %>
  </div>
  <!-- end of templates -->
  <div id="issue_editor"> </div>
  <div class="meta" id="last_updated"><%= date_string_with_milliseconds( (@last_updated.blank? ? Time.now : @last_updated.updated_on) )  %></div>
  <div id="charts"> </div>
  <div id="preloader">
    <div id="spinner"> </div>
    <div id="warning"> </div>
  </div>
<%- end %>
